﻿using CommunityToolkit.Mvvm.DependencyInjection;
using Kang.Monitor.Wpf.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Kang.Monitor.Wpf
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private MainViewModel mainViewModel;

        public MainWindow()
        {
            InitializeComponent();
            mainViewModel = Ioc.Default.GetRequiredService<MainViewModel>();
            this.DataContext = mainViewModel;
        }

        private void window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                this.DragMove();
            }
        }

        private void PackIcon_Close(object sender, MouseButtonEventArgs e)
        {
            this.DialogResult = true;
            // e.Handled = true;
        }

        private void PackIcon_Max(object sender, MouseButtonEventArgs e)
        {
            if (WindowState == WindowState.Maximized)
            {
                WindowState = WindowState.Normal;
            }
            else
            {
                WindowState = WindowState.Maximized;
            }
            //e.Handled = true;
        }

        private void PackIcon_Min(object sender, MouseButtonEventArgs e)
        {
            WindowState = WindowState.Minimized;
            // e.Handled = true;
        }
    }
}